package org.afs.gescol.core.model.params;

import java.util.Calendar;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.afs.gescol.core.model.references.Cycle;
import org.afs.gescol.core.model.references.Period;
import org.afs.gescol.core.model.references.PeriodStatus;
import org.hibernate.annotations.ForeignKey;
import org.scub.foundation.framework.core.model.BaseModel;

/**
 * Parameter model for school year split.
 * @autor Kobla GBENYO (kobla.gbenyo@gmail.com)
 */
@Entity
@Table(name = "param_year_split")
@AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "year_split_id", nullable = false)),
    @AttributeOverride(name = "version", column = @Column(name = "year_split_version", nullable = false, unique = false)),
})
public class YearSplit extends BaseModel {

    /** Serial Version UID. */
    private static final long serialVersionUID = 8933358969046667953L;

    @ManyToOne
    @JoinColumn(name = "year_id")
    @ForeignKey(name = "fk_param_year_split_param_year_id")
    private Year year;

    @ManyToOne
    @JoinColumn(name = "period_id")
    @ForeignKey(name = "fk_param_year_split_ref_period_id")
    private Period period;

    @ManyToOne
    @JoinColumn(name = "cycle_id")
    @ForeignKey(name = "fk_param_year_split_ref_cycle_id")
    private Cycle cycle;

    @ManyToOne
    @JoinColumn(name = "status_id")
    @ForeignKey(name = "fk_param_year_split_ref_period_status_id")
    private PeriodStatus status;

    @Column(name = "begin_date")
    private Calendar beginDate;

    @Column(name = "end_date")
    private Calendar endDate;

    @Override
    public boolean equals(Object other) {
        return equalsUtil(other);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

    /**
     * Get the value of year.
     * @return the year
     */
    public Year getYear() {
        return year;
    }

    /**
     * Set the value of year.
     * @param year the year to set
     */
    public void setYear(Year year) {
        this.year = year;
    }

    /**
     * Get the value of period.
     * @return the period
     */
    public Period getPeriod() {
        return period;
    }

    /**
     * Set the value of period.
     * @param period the period to set
     */
    public void setPeriod(Period period) {
        this.period = period;
    }

    /**
     * Get the value of cycle.
     * @return the cycle
     */
    public Cycle getCycle() {
        return cycle;
    }

    /**
     * Set the value of cycle.
     * @param cycle the cycle to set
     */
    public void setCycle(Cycle cycle) {
        this.cycle = cycle;
    }

    /**
     * Get the value of status.
     * @return the status
     */
    public PeriodStatus getStatus() {
        return status;
    }

    /**
     * Set the value of status.
     * @param status the status to set
     */
    public void setStatus(PeriodStatus status) {
        this.status = status;
    }

    /**
     * Get the value of beginDate.
     * @return the beginDate
     */
    public Calendar getBeginDate() {
        return beginDate;
    }

    /**
     * Set the value of beginDate.
     * @param beginDate the beginDate to set
     */
    public void setBeginDate(Calendar beginDate) {
        this.beginDate = beginDate;
    }

    /**
     * Get the value of endDate.
     * @return the endDate
     */
    public Calendar getEndDate() {
        return endDate;
    }

    /**
     * Set the value of endDate.
     * @param endDate the endDate to set
     */
    public void setEndDate(Calendar endDate) {
        this.endDate = endDate;
    }

}
